#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
    string s;
    char c;
    getline(cin,s);
    string s1;
    getline(cin,s1);
    c = s1[0];
   
    int times = 0;
    for(int i = 0; i< s.size(); i++)
    {
        if(s[i] == c)
            times++;
    }
    cout << times;
}